package designpattern.decorate;

import designpattern.decorate.coffee.Coffee;
import designpattern.decorate.coffee.ShortBlackCoffee;
import designpattern.decorate.flavour.ChocolateFlavour;
import designpattern.decorate.flavour.MilkFlavour;
import designpattern.decorate.flavour.SoyFlavour;

/*
    点咖啡案例：
        咖啡有多重，调料也有多种，可以随意组合
 */
public class Client {
    public static void main(String[] args) {
        Coffee coffee = new ShortBlackCoffee();
        System.out.println("描述:"+coffee.getDec()+",价格:"+coffee.cost());

        coffee = new SoyFlavour(coffee);
        System.out.println("加入Soy后:");
        System.out.println("描述:"+coffee.getDec()+",价格:"+coffee.cost());

        coffee = new MilkFlavour(coffee);
        System.out.println("加入Milk后:");
        System.out.println("描述:"+coffee.getDec()+",价格:"+coffee.cost());

        coffee = new ChocolateFlavour(coffee);
        System.out.println("加入Chocolate后:");
        System.out.println("描述:"+coffee.getDec()+",价格:"+coffee.cost());
    }
}
